<!doctype html>
<html class="no-js" lang="en" data-content_root="./">
  <head><meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="genindex.html"><link rel="search" title="Search" href="search.html"><link rel="next" title="OSXPhotos Python Package Overview" href="package_overview.html"><link rel="prev" title="OSXPhotos Command Line Interface (CLI)" href="cli.html">

    <!-- Generated with Sphinx 8.2.3 and Furo 2025.09.25 -->
        <title>OSXPhotos Template System - osxphotos 0.74.2 documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d111a655" />
    <link rel="stylesheet" type="text/css" href="_static/styles/furo.css?v=580074bf" />
    <link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
    <link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?v=8dab3a3b" />
    
    


<style>
  body {
    --color-code-background: #f2f2f2;
  --color-code-foreground: #1e1e1e;
  
  }
  @media not print {
    body[data-theme="dark"] {
      --color-code-background: #202020;
  --color-code-foreground: #d0d0d0;
  
    }
    @media (prefers-color-scheme: dark) {
      body:not([data-theme="light"]) {
        --color-code-background: #202020;
  --color-code-foreground: #d0d0d0;
  
      }
    }
  }
</style></head>
  <body>
    
    <script>
      document.body.dataset.theme = localStorage.getItem("theme") || "auto";
    </script>
    

<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
  <symbol id="svg-toc" viewBox="0 0 24 24">
    <title>Contents</title>
    <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
      <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
    </svg>
  </symbol>
  <symbol id="svg-menu" viewBox="0 0 24 24">
    <title>Menu</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
      <line x1="3" y1="12" x2="21" y2="12"></line>
      <line x1="3" y1="6" x2="21" y2="6"></line>
      <line x1="3" y1="18" x2="21" y2="18"></line>
    </svg>
  </symbol>
  <symbol id="svg-arrow-right" viewBox="0 0 24 24">
    <title>Expand</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
      <polyline points="9 18 15 12 9 6"></polyline>
    </svg>
  </symbol>
  <symbol id="svg-sun" viewBox="0 0 24 24">
    <title>Light mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
      <circle cx="12" cy="12" r="5"></circle>
      <line x1="12" y1="1" x2="12" y2="3"></line>
      <line x1="12" y1="21" x2="12" y2="23"></line>
      <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
      <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
      <line x1="1" y1="12" x2="3" y2="12"></line>
      <line x1="21" y1="12" x2="23" y2="12"></line>
      <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
      <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
    </svg>
  </symbol>
  <symbol id="svg-moon" viewBox="0 0 24 24">
    <title>Dark mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
      <path stroke="none" d="M0 0h24v24H0z" fill="none" />
      <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
    </svg>
  </symbol>
  <symbol id="svg-sun-with-moon" viewBox="0 0 24 24">
    <title>Auto light/dark, in light mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
      class="icon-custom-derived-from-feather-sun-and-tabler-moon">
      <path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/>
      <line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/>
      <line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/>
      <line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/>
      <line x1="19" y1="14.05" x2="20.414" y2="15.464"/>
      <line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/>
      <line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/>
      <line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/>
      <line x1="19" y1="5.05" x2="20.414" y2="3.636"/>
      <circle cx="14.5" cy="9.55" r="3.6"/>
    </svg>
  </symbol>
  <symbol id="svg-moon-with-sun" viewBox="0 0 24 24">
    <title>Auto light/dark, in dark mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
      class="icon-custom-derived-from-feather-sun-and-tabler-moon">
      <path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/>
      <line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/>
      <line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/>
      <line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/>
      <line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/>
      <line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/>
      <line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/>
      <line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/>
      <line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/>
      <circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/>
    </svg>
  </symbol>
  <symbol id="svg-pencil" viewBox="0 0 24 24">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code">
      <path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" />
      <path d="M13.5 6.5l4 4" />
      <path d="M20 21l2 -2l-2 -2" />
      <path d="M17 17l-2 2l2 2" />
    </svg>
  </symbol>
  <symbol id="svg-eye" viewBox="0 0 24 24">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code">
      <path stroke="none" d="M0 0h24v24H0z" fill="none" />
      <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
      <path
        d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" />
      <path d="M20 21l2 -2l-2 -2" />
      <path d="M17 17l-2 2l2 2" />
    </svg>
  </symbol>
</svg>

<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation" aria-label="Toggle site navigation sidebar">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc" aria-label="Toggle table of contents sidebar">
<label class="overlay sidebar-overlay" for="__navigation"></label>
<label class="overlay toc-overlay" for="__toc"></label>

<a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a>



<div class="page">
  <header class="mobile-header">
    <div class="header-left">
      <label class="nav-overlay-icon" for="__navigation">
        <span class="icon"><svg><use href="#svg-menu"></use></svg></span>
      </label>
    </div>
    <div class="header-center">
      <a href="index.html"><div class="brand">osxphotos 0.74.2 documentation</div></a>
    </div>
    <div class="header-right">
      <div class="theme-toggle-container theme-toggle-header">
        <button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
          <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
          <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
          <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
          <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
        </button>
      </div>
      <label class="toc-overlay-icon toc-header-icon" for="__toc">
        <span class="icon"><svg><use href="#svg-toc"></use></svg></span>
      </label>
    </div>
  </header>
  <aside class="sidebar-drawer">
    <div class="sidebar-container">
      
      <div class="sidebar-sticky"><a class="sidebar-brand" href="index.html">
  
  <span class="sidebar-brand-text">osxphotos 0.74.2 documentation</span>
  
</a><form class="sidebar-search-container" method="get" action="search.html" role="search">
  <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
  <input type="hidden" name="check_keywords" value="yes">
  <input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
  <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">OSXPhotos</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">OSXPhotos Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="cli.html">OSXPhotos Command Line Interface (CLI)</a></li>
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">OSXPhotos Template System</a></li>
<li class="toctree-l1"><a class="reference internal" href="package_overview.html">OSXPhotos Python Package Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="API_README.html">OSXPhotos Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="reference.html">OSXPhotos Python Reference</a></li>
</ul>

</div>
</div>

      </div>
      
    </div>
  </aside>
  <div class="main">
    <div class="content">
      <div class="article-container">
        <a href="#" class="back-to-top muted-link">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
          </svg>
          <span>Back to top</span>
        </a>
        <div class="content-icon-container">
          <div class="view-this-page">
  <a class="muted-link" href="_sources/template_help.rst.txt" title="View this page">
    <svg><use href="#svg-eye"></use></svg>
    <span class="visually-hidden">View this page</span>
  </a>
</div>
<div class="theme-toggle-container theme-toggle-content">
            <button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
              <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
              <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
              <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
              <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
            </button>
          </div>
          <label class="toc-overlay-icon toc-content-icon" for="__toc">
            <span class="icon"><svg><use href="#svg-toc"></use></svg></span>
          </label>
        </div>
        <article role="main" id="furo-main-content">
          <section id="osxphotos-template-system">
<h1>OSXPhotos Template System<a class="headerlink" href="#osxphotos-template-system" title="Link to this heading">¶</a></h1>
<p>The templating system converts one or template statements, written in osxphotos metadata templating language, to one or more rendered values using information from the photo being processed.</p>
<p>In its simplest form, a template statement has the form: <code class="docutils literal notranslate"><span class="pre">&quot;{template_field}&quot;</span></code>, for example <code class="docutils literal notranslate"><span class="pre">&quot;{title}&quot;</span></code> which would resolve to the title of the photo.</p>
<p>Template statements may contain one or more modifiers.  The full syntax is:</p>
<p><code class="docutils literal notranslate"><span class="pre">&quot;pretext{delim+template_field:subfield(field_arg)|filter[find,replace]</span> <span class="pre">conditional&amp;combine_value?bool_value,default}posttext&quot;</span></code></p>
<p>Template statements are white-space sensitive meaning that white space (spaces, tabs) changes the meaning of the template statement.</p>
<p><code class="docutils literal notranslate"><span class="pre">pretext</span></code> and <code class="docutils literal notranslate"><span class="pre">posttext</span></code> are free form text.  For example, if a photo has title &quot;My Photo Title&quot; the template statement <code class="docutils literal notranslate"><span class="pre">&quot;The</span> <span class="pre">title</span> <span class="pre">of</span> <span class="pre">the</span> <span class="pre">photo</span> <span class="pre">is</span> <span class="pre">{title}&quot;</span></code>, resolves to <code class="docutils literal notranslate"><span class="pre">&quot;The</span> <span class="pre">title</span> <span class="pre">of</span> <span class="pre">the</span> <span class="pre">photo</span> <span class="pre">is</span> <span class="pre">My</span> <span class="pre">Photo</span> <span class="pre">Title&quot;</span></code>.  The <code class="docutils literal notranslate"><span class="pre">pretext</span></code> in this example is <code class="docutils literal notranslate"><span class="pre">&quot;The</span> <span class="pre">title</span> <span class="pre">if</span> <span class="pre">the</span> <span class="pre">photo</span> <span class="pre">is</span> <span class="pre">&quot;</span></code> and the template_field is <code class="docutils literal notranslate"><span class="pre">{title}</span></code>.</p>
<p><code class="docutils literal notranslate"><span class="pre">delim</span></code>: optional delimiter string to use when expanding multi-valued template values in-place</p>
<p><code class="docutils literal notranslate"><span class="pre">+</span></code>: If present before template <code class="docutils literal notranslate"><span class="pre">name</span></code>, expands the template in place.  If <code class="docutils literal notranslate"><span class="pre">delim</span></code> not provided, values are joined with no delimiter.</p>
<p>e.g. if Photo keywords are <code class="docutils literal notranslate"><span class="pre">[&quot;foo&quot;,&quot;bar&quot;]</span></code>:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{keyword}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;foo&quot;,</span> <span class="pre">&quot;bar&quot;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{,+keyword}&quot;</span></code> renders to: <code class="docutils literal notranslate"><span class="pre">&quot;foo,bar&quot;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{;</span> <span class="pre">+keyword}&quot;</span></code> renders to: <code class="docutils literal notranslate"><span class="pre">&quot;foo;</span> <span class="pre">bar&quot;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{+keyword}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;foobar&quot;</span></code></p></li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">template_field</span></code>: The template field to resolve.  See <a class="reference external" href="#template-substitutions">Template Substitutions</a> for full list of template fields.</p>
<p><cite>:subfield</cite>: Some templates have sub-fields, For example, <cite>{exiftool:IPTC:Make}`</cite>; the template_field is``exiftool<code class="docutils literal notranslate"><span class="pre">and</span> <span class="pre">the</span> <span class="pre">sub-field</span> <span class="pre">is</span></code>IPTC:Make`.</p>
<p><code class="docutils literal notranslate"><span class="pre">(field_arg)</span></code>: optional arguments to pass to the field; for example, with <code class="docutils literal notranslate"><span class="pre">{folder_album}</span></code> this is used to pass the path separator used for joining folders and albums when rendering the field (default is &quot;/&quot; for <code class="docutils literal notranslate"><span class="pre">{folder_album}</span></code>).</p>
<p><cite>|filter</cite>: You may optionally append one or more filter commands to the end of the template field using the vertical pipe ('|') symbol.  Filters may be combined, separated by '|' as in: <code class="docutils literal notranslate"><span class="pre">{keyword|capitalize|parens}</span></code>.</p>
<p>Valid filters are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">lower</span></code>: Convert value to lower case, e.g. 'Value' =&gt; 'value'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">upper</span></code>: Convert value to upper case, e.g. 'Value' =&gt; 'VALUE'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">strip</span></code>: Strip whitespace from beginning/end of value, e.g. ' Value ' =&gt; 'Value'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">titlecase</span></code>: Convert value to title case, e.g. 'my value' =&gt; 'My Value'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">capitalize</span></code>: Capitalize first word of value and convert other words to lower case, e.g. 'MY VALUE' =&gt; 'My value'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">braces</span></code>: Enclose value in curly braces, e.g. 'value =&gt; '{value}'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">parens</span></code>: Enclose value in parentheses, e.g. 'value' =&gt; '(value')</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">brackets</span></code>: Enclose value in brackets, e.g. 'value' =&gt; '[value]'</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">shell_quote</span></code>: Quotes the value for safe usage in the shell, e.g. My file.jpeg =&gt; 'My file.jpeg'; only adds quotes if needed.</p></li>
<li><p><cite>function</cite>: Run custom python function to filter value; use in format 'function:/path/to/file.py::function_name'. See example at https://github.com/RhetTbull/osxphotos/blob/master/examples/template_filter.py</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">split(x)</span></code>: Split value into a list of values using x as delimiter, e.g. 'value1;value2' =&gt; ['value1', 'value2'] if used with split(;).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">autosplit</span></code>: Automatically split delimited string into separate values; will split strings delimited by comma, semicolon, or space, e.g. 'value1,value2' =&gt; ['value1', 'value2'].</p></li>
<li><p><cite>chop(x)</cite>: Remove x characters off the end of value, e.g. chop(1): 'Value' =&gt; 'Valu'; when applied to a list, chops characters from each list value, e.g. chop(1): ['travel', 'beach']=&gt; ['trave', 'beac'].</p></li>
<li><p><cite>chomp(x)</cite>: Remove x characters from the beginning of value, e.g. chomp(1): ['Value'] =&gt; ['alue']; when applied to a list, removes characters from each list value, e.g. chomp(1): ['travel', 'beach']=&gt; ['ravel', 'each'].</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">sort</span></code>: Sort list of values, e.g. ['c', 'b', 'a'] =&gt; ['a', 'b', 'c'].</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">rsort</span></code>: Sort list of values in reverse order, e.g. ['a', 'b', 'c'] =&gt; ['c', 'b', 'a'].</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">reverse</span></code>: Reverse order of values, e.g. ['a', 'b', 'c'] =&gt; ['c', 'b', 'a'].</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">uniq</span></code>: Remove duplicate values, e.g. ['a', 'b', 'c', 'b', 'a'] =&gt; ['a', 'b', 'c'].</p></li>
<li><p><cite>join(x)</cite>: Join list of values with delimiter x, e.g. join(,): ['a', 'b', 'c'] =&gt; 'a,b,c'; the DELIM option functions similar to join(x) but with DELIM, the join happens before being passed to any filters.May optionally be used without an argument, that is 'join()' which joins values together with no delimiter. e.g. join(): ['a', 'b', 'c'] =&gt; 'abc'.</p></li>
<li><p><cite>append(x)</cite>: Append x to list of values, e.g. append(d): ['a', 'b', 'c'] =&gt; ['a', 'b', 'c', 'd'].</p></li>
<li><p><cite>prepend(x)</cite>: Prepend x to list of values, e.g. prepend(d): ['a', 'b', 'c'] =&gt; ['d', 'a', 'b', 'c'].</p></li>
<li><p><cite>appends(x)</cite>: Append s[tring] Append x to each value of list of values, e.g. appends(d): ['a', 'b', 'c'] =&gt; ['ad', 'bd', 'cd'].</p></li>
<li><p><cite>prepends(x)</cite>: Prepend s[tring] x to each value of list of values, e.g. prepends(d): ['a', 'b', 'c'] =&gt; ['da', 'db', 'dc'].</p></li>
<li><p><cite>remove(x)</cite>: Remove x from list of values, e.g. remove(b): ['a', 'b', 'c'] =&gt; ['a', 'c'].</p></li>
<li><p><cite>slice(start:stop:step)</cite>: Slice list using same semantics as Python's list slicing, e.g. slice(1:3): ['a', 'b', 'c', 'd'] =&gt; ['b', 'c']; slice(1:4:2): ['a', 'b', 'c', 'd'] =&gt; ['b', 'd']; slice(1:): ['a', 'b', 'c', 'd'] =&gt; ['b', 'c', 'd']; slice(:-1): ['a', 'b', 'c', 'd'] =&gt; ['a', 'b', 'c']; slice(::-1): ['a', 'b', 'c', 'd'] =&gt; ['d', 'c', 'b', 'a']. See also sslice().</p></li>
<li><p><cite>sslice(start:stop:step)</cite>: [s(tring) slice] Slice values in a list using same semantics as Python's string slicing, e.g. sslice(1:3):'abcd =&gt; 'bc'; sslice(1:4:2): 'abcd' =&gt; 'bd', etc. See also slice().</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">filter(x)</span></code>: Filter list of values using predicate x; for example, '{folder_album|filter(contains Events)}' returns only folders/albums containing the word 'Events' in their path.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">int</span></code>: Convert values in list to integer, e.g. 1.0 =&gt; 1. If value cannot be converted to integer, remove value from list. ['1.1', 'x'] =&gt; ['1']. See also float.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">float</span></code>: Convert values in list to floating point number, e.g. 1 =&gt; 1.0. If value cannot be converted to float, remove value from list. ['1', 'x'] =&gt; ['1.0']. See also int.</p></li>
</ul>
<p>e.g. if Photo keywords are <code class="docutils literal notranslate"><span class="pre">[&quot;FOO&quot;,&quot;bar&quot;]</span></code>:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{keyword|lower}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;foo&quot;,</span> <span class="pre">&quot;bar&quot;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{keyword|upper}&quot;</span></code> renders to: <code class="docutils literal notranslate"><span class="pre">&quot;FOO&quot;,</span> <span class="pre">&quot;BAR&quot;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{keyword|capitalize}&quot;</span></code> renders to: <code class="docutils literal notranslate"><span class="pre">&quot;Foo&quot;,</span> <span class="pre">&quot;Bar&quot;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{keyword|lower|parens}&quot;</span></code> renders to: <code class="docutils literal notranslate"><span class="pre">&quot;(foo)&quot;,</span> <span class="pre">&quot;(bar)&quot;</span></code></p></li>
</ul>
<p>e.g. if Photo description is &quot;my description&quot;:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{descr|titlecase}&quot;</span></code> renders to: <code class="docutils literal notranslate"><span class="pre">&quot;My</span> <span class="pre">Description&quot;</span></code></p></li>
</ul>
<p>e.g. If Photo is in <code class="docutils literal notranslate"><span class="pre">Album1</span></code> in <code class="docutils literal notranslate"><span class="pre">Folder1</span></code>:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{folder_album}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">[&quot;Folder1/Album1&quot;]</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{folder_album(&gt;)}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">[&quot;Folder1&gt;Album1&quot;]</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{folder_album()}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">[&quot;Folder1Album1&quot;]</span></code></p></li>
</ul>
<p><cite>[find,replace]</cite>: optional text replacement to perform on rendered template value.  For example, to replace &quot;/&quot; in an album name, you could use the template <cite>&quot;{album[/,-]}&quot;</cite>.  Multiple replacements can be made by appending &quot;|&quot; and adding another find|replace pair.  e.g. to replace both &quot;/&quot; and &quot;:&quot; in album name: <code class="docutils literal notranslate"><span class="pre">&quot;{album[/,-|:,-]}&quot;</span></code>.  find/replace pairs are not limited to single characters.  The &quot;|&quot; character cannot be used in a find/replace pair.</p>
<p><cite>conditional</cite>: optional conditional expression that is evaluated as boolean (True/False) for use with the <cite>?bool_value</cite> modifier.  Conditional expressions take the form '<cite>not operator value</cite>' where <cite>not</cite> is an optional modifier that negates the <cite>operator</cite>.  Note: the space before the conditional expression is required if you use a conditional expression.  Valid comparison operators are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">contains</span></code>: template field contains value, similar to python's <code class="docutils literal notranslate"><span class="pre">in</span></code></p></li>
<li><p><cite>matches</cite>: template field contains exactly value, unlike <cite>contains</cite>: does not match partial matches</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">startswith</span></code>: template field starts with value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">endswith</span></code>: template field ends with value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;=</span></code>: template field is less than or equal to value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&gt;=</span></code>: template field is greater than or equal to value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;</span></code>: template field is less than value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&gt;</span></code>: template field is greater than value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">==</span></code>: template field equals value</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">!=</span></code>: template field does not equal value</p></li>
</ul>
<p>The <code class="docutils literal notranslate"><span class="pre">value</span></code> part of the conditional expression is treated as a bare (unquoted) word/phrase.  Multiple values may be separated by '|' (the pipe symbol).  <code class="docutils literal notranslate"><span class="pre">value</span></code> is itself a template statement so you can use one or more template fields in <code class="docutils literal notranslate"><span class="pre">value</span></code> which will be resolved before the comparison occurs.</p>
<p>For example:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">{keyword</span> <span class="pre">matches</span> <span class="pre">Beach}</span></code> resolves to True if 'Beach' is a keyword. It would not match keyword 'BeachDay'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">{keyword</span> <span class="pre">contains</span> <span class="pre">Beach}</span></code> resolves to True if any keyword contains the word 'Beach' so it would match both 'Beach' and 'BeachDay'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">{photo.score.overall</span> <span class="pre">&gt;</span> <span class="pre">0.7}</span></code> resolves to True if the photo's overall aesthetic score is greater than 0.7.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">{keyword|lower</span> <span class="pre">contains</span> <span class="pre">beach}</span></code> uses the lower case filter to do case-insensitive matching to match any keyword that contains the word 'beach'.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">{keyword|lower</span> <span class="pre">not</span> <span class="pre">contains</span> <span class="pre">beach}</span></code> uses the <code class="docutils literal notranslate"><span class="pre">not</span></code> modifier to negate the comparison so this resolves to True if there is no keyword that matches 'beach'.</p></li>
</ul>
<p>Examples: to export photos that contain certain keywords with the <code class="docutils literal notranslate"><span class="pre">osxphotos</span> <span class="pre">export</span></code> command's <code class="docutils literal notranslate"><span class="pre">--directory</span></code> option:</p>
<p><code class="docutils literal notranslate"><span class="pre">--directory</span> <span class="pre">&quot;{keyword|lower</span> <span class="pre">matches</span> <span class="pre">travel|vacation?Travel-Photos,Not-Travel-Photos}&quot;</span></code></p>
<p>This exports any photo that has keywords 'travel' or 'vacation' into a directory 'Travel-Photos' and all other photos into directory 'Not-Travel-Photos'.</p>
<p>This can be used to rename files as well, for example:
<code class="docutils literal notranslate"><span class="pre">--filename</span> <span class="pre">&quot;{favorite?Favorite-{original_name},{original_name}}&quot;</span></code></p>
<p>This renames any photo that is a favorite as 'Favorite-ImageName.jpg' (where 'ImageName.jpg' is the original name of the photo) and all other photos with the unmodified original name.</p>
<p><cite>&amp;combine_value</cite>: Template fields may be combined with another template statement to return multiple values. The combine_value is another template statement. For example, the template {created.year&amp;{folder_album,}} would resolve to [&quot;1999&quot;, &quot;Vacation&quot;] if the photo was created in 1999 and was in the album Vacation. Because the combine_value is a template statement, multiple templates may be combined together by nesting the combine operator: {template1&amp;{template2&amp;{template3,},},}. In this example, a null default value is used to prevent the default value from being combined if any of the nested templates does not resolve to a value</p>
<p><code class="docutils literal notranslate"><span class="pre">?bool_value</span></code>: Template fields may be evaluated as boolean (True/False) by appending &quot;?&quot; after the field name (and following &quot;(field_arg)&quot; or &quot;[find/replace]&quot;.  If a field is True (e.g. photo is HDR and field is <code class="docutils literal notranslate"><span class="pre">&quot;{hdr}&quot;</span></code>) or has any value, the value following the &quot;?&quot; will be used to render the template instead of the actual field value.  If the template field evaluates to False (e.g. in above example, photo is not HDR) or has no value (e.g. photo has no title and field is <code class="docutils literal notranslate"><span class="pre">&quot;{title}&quot;</span></code>) then the default value following a &quot;,&quot; will be used.</p>
<p>e.g. if photo is an HDR image,</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{hdr?ISHDR,NOTHDR}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;ISHDR&quot;</span></code></p></li>
</ul>
<p>and if it is not an HDR image,</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{hdr?ISHDR,NOTHDR}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;NOTHDR&quot;</span></code></p></li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">,default</span></code>: optional default value to use if the template name has no value.  This modifier is also used for the value if False for boolean-type fields (see above) as well as to hold a sub-template for values like <code class="docutils literal notranslate"><span class="pre">{created.strftime}</span></code>.  If no default value provided, &quot;_&quot; is used.</p>
<p>e.g., if photo has no title set,</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{title}&quot;</span></code> renders to &quot;_&quot;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{title,I</span> <span class="pre">have</span> <span class="pre">no</span> <span class="pre">title}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;I</span> <span class="pre">have</span> <span class="pre">no</span> <span class="pre">title&quot;</span></code></p></li>
</ul>
<p>Template fields such as <code class="docutils literal notranslate"><span class="pre">created.strftime</span></code> use the default value to pass the template to use for <code class="docutils literal notranslate"><span class="pre">strftime</span></code>.</p>
<p>e.g., if photo date is 4 February 2020, 19:07:38,</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&quot;{created.strftime,%Y-%m-%d-%H%M%S}&quot;</span></code> renders to <code class="docutils literal notranslate"><span class="pre">&quot;2020-02-04-190738&quot;</span></code></p></li>
</ul>
<p>Some template fields such as <code class="docutils literal notranslate"><span class="pre">&quot;{media_type}&quot;</span></code> use the default value to allow customization of the output. For example, <code class="docutils literal notranslate"><span class="pre">&quot;{media_type}&quot;</span></code> resolves to the special media type of the photo such as <code class="docutils literal notranslate"><span class="pre">panorama</span></code> or <code class="docutils literal notranslate"><span class="pre">selfie</span></code>.  You may use the default value to override these in form: <code class="docutils literal notranslate"><span class="pre">&quot;{media_type,video=vidéo;time_lapse=vidéo_accélérée}&quot;</span></code>. In this example, if photo was a time_lapse photo, <code class="docutils literal notranslate"><span class="pre">media_type</span></code> would resolve to <code class="docutils literal notranslate"><span class="pre">vidéo_accélérée</span></code> instead of <code class="docutils literal notranslate"><span class="pre">time_lapse</span></code>.</p>
<p>Either or both bool_value or default (False value) may be empty which would result in empty string <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code> when rendered.</p>
<p>If you want to include &quot;{&quot; or &quot;}&quot; in the output, use &quot;{openbrace}&quot; or &quot;{closebrace}&quot; template substitution.</p>
<p>e.g. <code class="docutils literal notranslate"><span class="pre">&quot;{created.year}/{openbrace}{title}{closebrace}&quot;</span></code> would result in <code class="docutils literal notranslate"><span class="pre">&quot;2020/{Photo</span> <span class="pre">Title}&quot;</span></code>.</p>
<p><strong>Variables</strong></p>
<p>You can define variables for later use in the template string using the format <code class="docutils literal notranslate"><span class="pre">{var:NAME,VALUE}</span></code> where <code class="docutils literal notranslate"><span class="pre">VALUE</span></code> is a template statement.  Variables may then be referenced using the format <code class="docutils literal notranslate"><span class="pre">%NAME</span></code>. For example: <code class="docutils literal notranslate"><span class="pre">{var:foo,bar}</span></code> defines the variable <code class="docutils literal notranslate"><span class="pre">%foo</span></code> to have value <code class="docutils literal notranslate"><span class="pre">bar</span></code>. This can be useful if you want to re-use a complex template value in multiple places within your template string or for allowing the use of characters that would otherwise be prohibited in a template string. For example, the &quot;pipe&quot; (<code class="docutils literal notranslate"><span class="pre">|</span></code>) character is not allowed in a find/replace pair but you can get around this limitation like so: <code class="docutils literal notranslate"><span class="pre">{var:pipe,{pipe}}{title[-,%pipe]}</span></code> which replaces the <code class="docutils literal notranslate"><span class="pre">-</span></code> character with <code class="docutils literal notranslate"><span class="pre">|</span></code> (the value of <code class="docutils literal notranslate"><span class="pre">%pipe</span></code>).</p>
<p>Another use case for variables is filtering combined template values. For example, using the <code class="docutils literal notranslate"><span class="pre">&amp;combine_value</span></code> mechanism to combine two template values that might result in duplicate values, you could do the following: <code class="docutils literal notranslate"><span class="pre">{var:myvar,{template1&amp;{template2,},}}{%myvar|uniq}</span></code> which allows the use of the uniq filter against the combined template values.</p>
<p>Variables can also be referenced as fields in the template string, for example: <code class="docutils literal notranslate"><span class="pre">{var:year,{created.year}}{original_name}-{%year}</span></code>. In some cases, use of variables can make your template string more readable.  Variables can be used as template fields, as values for filters, as values for conditional operations, or as default values.  When used as a conditional value or default value, variables should be treated like any other field and enclosed in braces as conditional and default values are evaluated as template strings. For example: <code class="docutils literal notranslate"><span class="pre">{var:name,Katie}{person</span> <span class="pre">contains</span> <span class="pre">{%name}?{%name},Not-{%name}}</span></code>.</p>
<p>If you need to use a <code class="docutils literal notranslate"><span class="pre">%</span></code> (percent sign character), you can escape the percent sign by using <code class="docutils literal notranslate"><span class="pre">%%</span></code>.  You can also use the <code class="docutils literal notranslate"><span class="pre">{percent}</span></code> template field where a template field is required. For example:</p>
<p><code class="docutils literal notranslate"><span class="pre">{title[:,%%]}</span></code> replaces the <code class="docutils literal notranslate"><span class="pre">:</span></code> with <code class="docutils literal notranslate"><span class="pre">%</span></code> and <code class="docutils literal notranslate"><span class="pre">{title</span> <span class="pre">contains</span> <span class="pre">Foo?{title}{percent},{title}}</span></code> adds <code class="docutils literal notranslate"><span class="pre">%</span></code> to the  title if it contains <code class="docutils literal notranslate"><span class="pre">Foo</span></code>.</p>
<section id="id1">
<h2>Template Substitutions<a class="headerlink" href="#id1" title="Link to this heading">¶</a></h2>
<div class="table-wrapper docutils container">
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Field</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>{name}</p></td>
<td><p>Current filename of the photo</p></td>
</tr>
<tr class="row-odd"><td><p>{original_name}</p></td>
<td><p>Photo's original filename when imported to Photos</p></td>
</tr>
<tr class="row-even"><td><p>{title}</p></td>
<td><p>Title of the photo</p></td>
</tr>
<tr class="row-odd"><td><p>{descr}</p></td>
<td><p>Description of the photo</p></td>
</tr>
<tr class="row-even"><td><p>{media_type}</p></td>
<td><p>Special media type resolved in this precedence: selfie, time_lapse, panorama, slow_mo, screenshot, screen_recording, portrait, live_photo, burst, photo, video. Defaults to 'photo' or 'video' if no special type. Customize one or more media types using format: '{media_type,video=vidéo;time_lapse=vidéo_accélérée}'</p></td>
</tr>
<tr class="row-odd"><td><p>{photo_or_video}</p></td>
<td><p>'photo' or 'video' depending on what type the image is. To customize, use default value as in '{photo_or_video,photo=fotos;video=videos}'</p></td>
</tr>
<tr class="row-even"><td><p>{hdr}</p></td>
<td><p>Photo is HDR?; True/False value, use in format '{hdr?VALUE_IF_TRUE,VALUE_IF_FALSE}'</p></td>
</tr>
<tr class="row-odd"><td><p>{edited}</p></td>
<td><p>True if photo has been edited (has adjustments), otherwise False; use in format '{edited?VALUE_IF_TRUE,VALUE_IF_FALSE}'</p></td>
</tr>
<tr class="row-even"><td><p>{edited_version}</p></td>
<td><p>True if template is being rendered for the edited version of a photo, otherwise False.</p></td>
</tr>
<tr class="row-odd"><td><p>{favorite}</p></td>
<td><p>Photo has been marked as favorite?; True/False value, use in format '{favorite?VALUE_IF_TRUE,VALUE_IF_FALSE}'</p></td>
</tr>
<tr class="row-even"><td><p>{created}</p></td>
<td><p>Photo's creation date in ISO format, e.g. '2020-03-22'</p></td>
</tr>
<tr class="row-odd"><td><p>{created.date}</p></td>
<td><p>Photo's creation date in ISO format, e.g. '2020-03-22'</p></td>
</tr>
<tr class="row-even"><td><p>{created.year}</p></td>
<td><p>4-digit year of photo creation time</p></td>
</tr>
<tr class="row-odd"><td><p>{created.yy}</p></td>
<td><p>2-digit year of photo creation time</p></td>
</tr>
<tr class="row-even"><td><p>{created.mm}</p></td>
<td><p>2-digit month of the photo creation time (zero padded)</p></td>
</tr>
<tr class="row-odd"><td><p>{created.month}</p></td>
<td><p>Month name in user's locale of the photo creation time</p></td>
</tr>
<tr class="row-even"><td><p>{created.mon}</p></td>
<td><p>Month abbreviation in the user's locale of the photo creation time</p></td>
</tr>
<tr class="row-odd"><td><p>{created.dd}</p></td>
<td><p>2-digit day of the month (zero padded) of photo creation time</p></td>
</tr>
<tr class="row-even"><td><p>{created.dow}</p></td>
<td><p>Day of week in user's locale of the photo creation time</p></td>
</tr>
<tr class="row-odd"><td><p>{created.doy}</p></td>
<td><p>3-digit day of year (e.g Julian day) of photo creation time, starting from 1 (zero padded)</p></td>
</tr>
<tr class="row-even"><td><p>{created.hour}</p></td>
<td><p>2-digit hour of the photo creation time</p></td>
</tr>
<tr class="row-odd"><td><p>{created.min}</p></td>
<td><p>2-digit minute of the photo creation time</p></td>
</tr>
<tr class="row-even"><td><p>{created.sec}</p></td>
<td><p>2-digit second of the photo creation time</p></td>
</tr>
<tr class="row-odd"><td><p>{created.strftime}</p></td>
<td><p>Apply strftime template to file creation date/time. Should be used in form {created.strftime,TEMPLATE} where TEMPLATE is a valid strftime template, e.g. {created.strftime,%Y-%U} would result in year-week number of year: '2020-23'. If used with no template will return null value. See <a class="reference external" href="https://strftime.org/">https://strftime.org/</a> for help on strftime templates.</p></td>
</tr>
<tr class="row-even"><td><p>{modified}</p></td>
<td><p>Photo's modification date in ISO format, e.g. '2020-03-22'; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.date}</p></td>
<td><p>Photo's modification date in ISO format, e.g. '2020-03-22'; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-even"><td><p>{modified.year}</p></td>
<td><p>4-digit year of photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.yy}</p></td>
<td><p>2-digit year of photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-even"><td><p>{modified.mm}</p></td>
<td><p>2-digit month of the photo modification time (zero padded); uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.month}</p></td>
<td><p>Month name in user's locale of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-even"><td><p>{modified.mon}</p></td>
<td><p>Month abbreviation in the user's locale of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.dd}</p></td>
<td><p>2-digit day of the month (zero padded) of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-even"><td><p>{modified.dow}</p></td>
<td><p>Day of week in user's locale of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.doy}</p></td>
<td><p>3-digit day of year (e.g Julian day) of photo modification time, starting from 1 (zero padded); uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-even"><td><p>{modified.hour}</p></td>
<td><p>2-digit hour of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.min}</p></td>
<td><p>2-digit minute of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-even"><td><p>{modified.sec}</p></td>
<td><p>2-digit second of the photo modification time; uses creation date if photo is not modified</p></td>
</tr>
<tr class="row-odd"><td><p>{modified.strftime}</p></td>
<td><p>Apply strftime template to file modification date/time. Should be used in form {modified.strftime,TEMPLATE} where TEMPLATE is a valid strftime template, e.g. {modified.strftime,%Y-%U} would result in year-week number of year: '2020-23'. If used with no template will return null value. Uses creation date if photo is not modified. See <a class="reference external" href="https://strftime.org/">https://strftime.org/</a> for help on strftime templates.</p></td>
</tr>
<tr class="row-even"><td><p>{today}</p></td>
<td><p>Current date in iso format, e.g. '2020-03-22'</p></td>
</tr>
<tr class="row-odd"><td><p>{today.date}</p></td>
<td><p>Current date in iso format, e.g. '2020-03-22'</p></td>
</tr>
<tr class="row-even"><td><p>{today.year}</p></td>
<td><p>4-digit year of current date</p></td>
</tr>
<tr class="row-odd"><td><p>{today.yy}</p></td>
<td><p>2-digit year of current date</p></td>
</tr>
<tr class="row-even"><td><p>{today.mm}</p></td>
<td><p>2-digit month of the current date (zero padded)</p></td>
</tr>
<tr class="row-odd"><td><p>{today.month}</p></td>
<td><p>Month name in user's locale of the current date</p></td>
</tr>
<tr class="row-even"><td><p>{today.mon}</p></td>
<td><p>Month abbreviation in the user's locale of the current date</p></td>
</tr>
<tr class="row-odd"><td><p>{today.dd}</p></td>
<td><p>2-digit day of the month (zero padded) of current date</p></td>
</tr>
<tr class="row-even"><td><p>{today.dow}</p></td>
<td><p>Day of week in user's locale of the current date</p></td>
</tr>
<tr class="row-odd"><td><p>{today.doy}</p></td>
<td><p>3-digit day of year (e.g Julian day) of current date, starting from 1 (zero padded)</p></td>
</tr>
<tr class="row-even"><td><p>{today.hour}</p></td>
<td><p>2-digit hour of the current date</p></td>
</tr>
<tr class="row-odd"><td><p>{today.min}</p></td>
<td><p>2-digit minute of the current date</p></td>
</tr>
<tr class="row-even"><td><p>{today.sec}</p></td>
<td><p>2-digit second of the current date</p></td>
</tr>
<tr class="row-odd"><td><p>{today.strftime}</p></td>
<td><p>Apply strftime template to current date/time. Should be used in form {today.strftime,TEMPLATE} where TEMPLATE is a valid strftime template, e.g. {today.strftime,%Y-%U} would result in year-week number of year: '2020-23'. If used with no template will return null value. See <a class="reference external" href="https://strftime.org/">https://strftime.org/</a> for help on strftime templates.</p></td>
</tr>
<tr class="row-even"><td><p>{place.name}</p></td>
<td><p>Place name from the photo's reverse geolocation data, as displayed in Photos</p></td>
</tr>
<tr class="row-odd"><td><p>{place.country_code}</p></td>
<td><p>The ISO country code from the photo's reverse geolocation data</p></td>
</tr>
<tr class="row-even"><td><p>{place.name.country}</p></td>
<td><p>Country name from the photo's reverse geolocation data</p></td>
</tr>
<tr class="row-odd"><td><p>{place.name.state_province}</p></td>
<td><p>State or province name from the photo's reverse geolocation data</p></td>
</tr>
<tr class="row-even"><td><p>{place.name.city}</p></td>
<td><p>City or locality name from the photo's reverse geolocation data</p></td>
</tr>
<tr class="row-odd"><td><p>{place.name.area_of_interest}</p></td>
<td><p>Area of interest name (e.g. landmark or public place) from the photo's reverse geolocation data</p></td>
</tr>
<tr class="row-even"><td><p>{place.address}</p></td>
<td><p>Postal address from the photo's reverse geolocation data, e.g. '2007 18th St NW, Washington, DC 20009, United States'</p></td>
</tr>
<tr class="row-odd"><td><p>{place.address.street}</p></td>
<td><p>Street part of the postal address, e.g. '2007 18th St NW'</p></td>
</tr>
<tr class="row-even"><td><p>{place.address.city}</p></td>
<td><p>City part of the postal address, e.g. 'Washington'</p></td>
</tr>
<tr class="row-odd"><td><p>{place.address.state_province}</p></td>
<td><p>State/province part of the postal address, e.g. 'DC'</p></td>
</tr>
<tr class="row-even"><td><p>{place.address.postal_code}</p></td>
<td><p>Postal code part of the postal address, e.g. '20009'</p></td>
</tr>
<tr class="row-odd"><td><p>{place.address.country}</p></td>
<td><p>Country name of the postal address, e.g. 'United States'</p></td>
</tr>
<tr class="row-even"><td><p>{place.address.country_code}</p></td>
<td><p>ISO country code of the postal address, e.g. 'US'</p></td>
</tr>
<tr class="row-odd"><td><p>{searchinfo.season}</p></td>
<td><p>Season of the year associated with a photo, e.g. 'Summer'; (Photos 5+ only, applied automatically by Photos' image categorization algorithms).</p></td>
</tr>
<tr class="row-even"><td><p>{exif.camera_make}</p></td>
<td><p>Camera make from original photo's EXIF information as imported by Photos, e.g. 'Apple'</p></td>
</tr>
<tr class="row-odd"><td><p>{exif.camera_model}</p></td>
<td><p>Camera model from original photo's EXIF information as imported by Photos, e.g. 'iPhone 6s'</p></td>
</tr>
<tr class="row-even"><td><p>{exif.lens_model}</p></td>
<td><p>Lens model from original photo's EXIF information as imported by Photos, e.g. 'iPhone 6s back camera 4.15mm f/2.2'</p></td>
</tr>
<tr class="row-odd"><td><p>{moment}</p></td>
<td><p>The moment title of the photo</p></td>
</tr>
<tr class="row-even"><td><p>{uuid}</p></td>
<td><p>Photo's internal universally unique identifier (UUID) for the photo, a 36-character string unique to the photo, e.g. '128FB4C6-0B16-4E7D-9108-FB2E90DA1546'</p></td>
</tr>
<tr class="row-odd"><td><p>{shortuuid}</p></td>
<td><p>A shorter representation of photo's internal universally unique identifier (UUID) for the photo, a 22-character string unique to the photo, e.g. 'JYsxugP9UjetmCbBCHXcmu'</p></td>
</tr>
<tr class="row-even"><td><p>{id}</p></td>
<td><p>A unique number for the photo based on its primary key in the Photos database. A sequential integer, e.g. 1, 2, 3...etc.  Each asset associated with a photo (e.g. an image and Live Photo preview) will share the same id. May be formatted using a python string format code. For example, to format as a 5-digit integer and pad with zeros, use '{id:05d}' which results in 00001, 00002, 00003...etc.</p></td>
</tr>
<tr class="row-odd"><td><p>{counter}</p></td>
<td><p>A sequential counter, starting at 0, that increments each time it is evaluated.To start counting at a value other than 0, append append '(starting_value)' to the field name.For example, to start counting at 1 instead of 0: '{counter(1)}'.May be formatted using a python string format code.For example, to format as a 5-digit integer and pad with zeros, use '{counter:05d(1)}'which results in 00001, 00002, 00003...etc.You may also specify a stop value which causes the counter to reset to the starting valuewhen the stop value is reached and a step size which causes the counter to increment bythe specified value instead of 1. Use the format '{counter(start,stop,step)}' where start,stop, and step are integers. For example, to count from 1 to 10 by 2, use '{counter(1,11,2)}'.Note that the counter stops counting when the stop value is reached and does not return thestop value. Start, stop, and step are optional and may be omitted. For example, to countfrom 0 by 2s, use '{counter(,,2)}'.You may create an arbitrary number of counters by appending a unique name to the field namepreceded by a period: '{counter.a}', '{counter.b}', etc. Each counter will have its own stateand will start at 0 and increment by 1 unless otherwise specified. Note: {counter} is not suitable for use with 'export' and '--update' as the counter associated with a photo may change between export sessions. See also {id}.</p></td>
</tr>
<tr class="row-even"><td><p>{album_seq}</p></td>
<td><p>An integer, starting at 0, indicating the photo's index (sequence) in the containing album. Only valid when used in a '--filename' template and only when '{album}' or '{folder_album}' is used in the '--directory' template. For example '--directory &quot;{folder_album}&quot; --filename &quot;{album<em>seq}</em>{original_name}&quot;'. To start counting at a value other than 0, append append '(starting_value)' to the field name.  For example, to start counting at 1 instead of 0: '{album_seq(1)}'. May be formatted using a python string format code. For example, to format as a 5-digit integer and pad with zeros, use '{album_seq:05d}' which results in 00000, 00001, 00002...etc. To format while also using a starting value: '{album_seq:05d(1)}' which results in 0001, 00002...etc.This may result in incorrect sequences if you have duplicate albums with the same name; see also '{folder_album_seq}'.</p></td>
</tr>
<tr class="row-odd"><td><p>{folder_album_seq}</p></td>
<td><p>An integer, starting at 0, indicating the photo's index (sequence) in the containing album and folder path. Only valid when used in a '--filename' template and only when '{folder_album}' is used in the '--directory' template. For example '--directory &quot;{folder_album}&quot; --filename &quot;{folder_album<em>seq}</em>{original_name}&quot;'. To start counting at a value other than 0, append '(starting_value)' to the field name. For example, to start counting at 1 instead of 0: '{folder_album_seq(1)}' May be formatted using a python string format code. For example, to format as a 5-digit integer and pad with zeros, use '{folder_album_seq:05d}' which results in 00000, 00001, 00002...etc. To format while also using a starting value: '{folder_album_seq:05d(1)}' which results in 0001, 00002...etc.This may result in incorrect sequences if you have duplicate albums with the same name in the same folder; see also '{album_seq}'.</p></td>
</tr>
<tr class="row-even"><td><p>{comma}</p></td>
<td><p>A comma: ','</p></td>
</tr>
<tr class="row-odd"><td><p>{semicolon}</p></td>
<td><p>A semicolon: ';'</p></td>
</tr>
<tr class="row-even"><td><p>{questionmark}</p></td>
<td><p>A question mark: '?'</p></td>
</tr>
<tr class="row-odd"><td><p>{pipe}</p></td>
<td><p>A vertical pipe: '|'</p></td>
</tr>
<tr class="row-even"><td><p>{percent}</p></td>
<td><p>A percent sign: '%'</p></td>
</tr>
<tr class="row-odd"><td><p>{ampersand}</p></td>
<td><p>an ampersand symbol: '&amp;'</p></td>
</tr>
<tr class="row-even"><td><p>{openbrace}</p></td>
<td><p>An open brace: '{'</p></td>
</tr>
<tr class="row-odd"><td><p>{closebrace}</p></td>
<td><p>A close brace: '}'</p></td>
</tr>
<tr class="row-even"><td><p>{openparens}</p></td>
<td><p>An open parentheses: '('</p></td>
</tr>
<tr class="row-odd"><td><p>{closeparens}</p></td>
<td><p>A close parentheses: ')'</p></td>
</tr>
<tr class="row-even"><td><p>{openbracket}</p></td>
<td><p>An open bracket: '['</p></td>
</tr>
<tr class="row-odd"><td><p>{closebracket}</p></td>
<td><p>A close bracket: ']'</p></td>
</tr>
<tr class="row-even"><td><p>{newline}</p></td>
<td><p>A newline: 'n'</p></td>
</tr>
<tr class="row-odd"><td><p>{lf}</p></td>
<td><p>A line feed: 'n', alias for {newline}</p></td>
</tr>
<tr class="row-even"><td><p>{cr}</p></td>
<td><p>A carriage return: 'r'</p></td>
</tr>
<tr class="row-odd"><td><p>{crlf}</p></td>
<td><p>A carriage return + line feed: 'rn'</p></td>
</tr>
<tr class="row-even"><td><p>{tab}</p></td>
<td><dl class="field-list simple">
<dt class="field-odd">A tab<span class="colon">:</span></dt>
<dd class="field-odd"><p>'t'</p>
</dd>
</dl>
</td>
</tr>
<tr class="row-odd"><td><p>{osxphotos_version}</p></td>
<td><p>The osxphotos version, e.g. '0.74.2'</p></td>
</tr>
<tr class="row-even"><td><p>{osxphotos_cmd_line}</p></td>
<td><p>The full command line used to run osxphotos</p></td>
</tr>
<tr class="row-odd"><td><p>{album}</p></td>
<td><p>Album(s) photo is contained in</p></td>
</tr>
<tr class="row-even"><td><p>{folder_album}</p></td>
<td><p>Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder</p></td>
</tr>
<tr class="row-odd"><td><p>{project}</p></td>
<td><p>Project(s) photo is contained in (such as greeting cards, calendars, slideshows)</p></td>
</tr>
<tr class="row-even"><td><p>{album_project}</p></td>
<td><p>Album(s) and project(s) photo is contained in; treats projects as regular albums</p></td>
</tr>
<tr class="row-odd"><td><p>{folder_album_project}</p></td>
<td><p>Folder path + album (includes projects as albums) photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder</p></td>
</tr>
<tr class="row-even"><td><p>{keyword}</p></td>
<td><p>Keyword(s) assigned to photo</p></td>
</tr>
<tr class="row-odd"><td><p>{person}</p></td>
<td><p>Person(s) / face(s) in a photo</p></td>
</tr>
<tr class="row-even"><td><p>{label}</p></td>
<td><p>Image categorization label associated with a photo (Photos 5+ only). Labels are added automatically by Photos using machine learning algorithms to categorize images. These are not the same as {keyword} which refers to the user-defined keywords/tags applied in Photos.</p></td>
</tr>
<tr class="row-odd"><td><p>{label_normalized}</p></td>
<td><p>All lower case version of 'label' (Photos 5+ only)</p></td>
</tr>
<tr class="row-even"><td><p>{comment}</p></td>
<td><p>Comment(s) on shared Photos; format is 'Person name: comment text' (Photos 5+ only)</p></td>
</tr>
<tr class="row-odd"><td><p>{exiftool}</p></td>
<td><p>Format: '{exiftool:GROUP:TAGNAME}'; use exiftool (https://exiftool.org) to extract metadata, in form GROUP:TAGNAME, from image.  E.g. '{exiftool:EXIF:Make}' to get camera make, or {exiftool:IPTC:Keywords} to extract keywords. See https://exiftool.org/TagNames/ for list of valid tag names.  You must specify group (e.g. EXIF, IPTC, etc) as used in 'exiftool -G'. exiftool must be installed in the path to use this template.</p></td>
</tr>
<tr class="row-even"><td><p>{searchinfo.holiday}</p></td>
<td><p>Holiday names associated with a photo, e.g. 'Christmas Day'; (Photos 5+ only, applied automatically by Photos' image categorization algorithms).</p></td>
</tr>
<tr class="row-odd"><td><p>{searchinfo.activity}</p></td>
<td><p>Activities associated with a photo, e.g. 'Sporting Event'; (Photos 5+ only, applied automatically by Photos' image categorization algorithms).</p></td>
</tr>
<tr class="row-even"><td><p>{searchinfo.venue}</p></td>
<td><p>Venues associated with a photo, e.g. name of restaurant; (Photos 5+ only, applied automatically by Photos' image categorization algorithms).</p></td>
</tr>
<tr class="row-odd"><td><p>{searchinfo.venue_type}</p></td>
<td><p>Venue types associated with a photo, e.g. 'Restaurant'; (Photos 5+ only, applied automatically by Photos' image categorization algorithms).</p></td>
</tr>
<tr class="row-even"><td><p>{photo}</p></td>
<td><p>Provides direct access to the PhotoInfo object for the photo. Must be used in format '{photo.property}' where 'property' represents a PhotoInfo property. For example: '{photo.favorite}' is the same as '{favorite}' and '{photo.place.name}' is the same as '{place.name}'. '{photo}' provides access to properties that are not available as separate template fields but it assumes some knowledge of the underlying PhotoInfo class.  See <a class="reference external" href="https://rhettbull.github.io/osxphotos/">https://rhettbull.github.io/osxphotos/</a> for additional documentation on the PhotoInfo class.</p></td>
</tr>
<tr class="row-odd"><td><p>{detected_text}</p></td>
<td><p>List of text strings found in the image after performing text detection. Using '{detected_text}' will cause osxphotos to perform text detection on your photos using the built-in macOS text detection algorithms which will slow down your export. The results for each photo will be cached in the export database so that future exports with '--update' do not need to reprocess each photo. You may pass a confidence threshold value between 0.0 and 1.0 after a colon as in '{detected_text:0.5}'; The default confidence threshold is 0.75. '{detected_text}' works only on macOS Catalina (10.15) or later. Note: this feature is not the same thing as Live Text in macOS Monterey, which osxphotos does not yet support.</p></td>
</tr>
<tr class="row-even"><td><p>{shell_quote}</p></td>
<td><p>Use in form '{shell_quote,TEMPLATE}'; quotes the rendered TEMPLATE value(s) for safe usage in the shell, e.g. My file.jpeg =&gt; 'My file.jpeg'; only adds quotes if needed.</p></td>
</tr>
<tr class="row-odd"><td><p>{strip}</p></td>
<td><p>Use in form '{strip,TEMPLATE}'; strips whitespace from begining and end of rendered TEMPLATE value(s).</p></td>
</tr>
<tr class="row-even"><td><p>{format}</p></td>
<td><p>Use in form '{format:TYPE:FORMAT,TEMPLATE}'; converts TEMPLATE value to TYPE then formats the value using Python string formatting codes specified by FORMAT; TYPE is one of: 'int', 'float', or 'str'. For example, '{format:float:.1f,{exiftool:EXIF:FocalLength}}' will format focal length to 1 decimal place (e.g. '100.0').</p></td>
</tr>
<tr class="row-odd"><td><p>{function}</p></td>
<td><p>Execute a python function from an external file and use return value as template substitution. Use in format: {function:file.py::function_name} where 'file.py' is the path/name of the python file and 'function_name' is the name of the function to call. The file name may also be url to a python file, e.g. '{function:https://raw.githubusercontent.com/RhetTbull/osxphotos/main/examples/template_function.py::example}'. The function will be passed the PhotoInfo object for the photo. See https://github.com/RhetTbull/osxphotos/blob/master/examples/template_function.py for an example of how to implement a template function.</p></td>
</tr>
</tbody>
</table>
</div>
</section>
</section>

        </article>
      </div>
      <footer>
        
        <div class="related-pages">
          <a class="next-page" href="package_overview.html">
              <div class="page-info">
                <div class="context">
                  <span>Next</span>
                </div>
                <div class="title">OSXPhotos Python Package Overview</div>
              </div>
              <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
            </a>
          <a class="prev-page" href="cli.html">
              <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
              <div class="page-info">
                <div class="context">
                  <span>Previous</span>
                </div>
                
                <div class="title">OSXPhotos Command Line Interface (CLI)</div>
                
              </div>
            </a>
        </div>
        <div class="bottom-of-page">
          <div class="left-details">
            <div class="copyright">
                Copyright &#169; 2021, Rhet Turnbull
            </div>
            Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
            
            <a href="https://github.com/pradyunsg/furo">Furo</a>
            
          </div>
          <div class="right-details">
            
          </div>
        </div>
        
      </footer>
    </div>
    <aside class="toc-drawer">
      
      
      <div class="toc-sticky toc-scroll">
        <div class="toc-title-container">
          <span class="toc-title">
            On this page
          </span>
        </div>
        <div class="toc-tree-container">
          <div class="toc-tree">
            <ul>
<li><a class="reference internal" href="#">OSXPhotos Template System</a><ul>
<li><a class="reference internal" href="#id1">Template Substitutions</a></li>
</ul>
</li>
</ul>

          </div>
        </div>
      </div>
      
      
    </aside>
  </div>
</div><script src="_static/documentation_options.js?v=63568c49"></script>
    <script src="_static/doctools.js?v=9bcbadda"></script>
    <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/scripts/furo.js?v=46bd48cc"></script>
    <script src="_static/clipboard.min.js?v=a7894cd8"></script>
    <script src="_static/copybutton.js?v=f281be69"></script>
    </body>
</html>